home *** CD-ROM | disk | FTP | other *** search
- #ifndef __OSUTILS__
- #include <OSUtils.h>
- #endif
- #include <QDOffscreen.h>
-
- /* ------------------------------------------------------------------------------------ */
- /* The following routines are used to help implement a blackout */
- /* ------------------------------------------------------------------------------------ */
-
- // Returns a value from 0 to max-1
- short Rnd(long max);
-
- // Places a rectangle on one of the screens at random. Rect is within screen bounds
- void PlaceRectOnScreen(
- short width, // width of rect, can be 0
- short height, // height of rect, can be 0
- Rect * placedRect, // Placed rect is returned here
- Rect * margins, // margins around screen, can be nil
- Rect * screenBound); // placed screen bounds returned here, can be nil
-
- // Handy offscreen pixmap type routines
- void MyNewGWorld(GWorldPtr *offscreenGWorld,short PixelDepth,Rect *boundsRect,
- CTabHandle cTable,GDHandle aGDevice,GWorldFlags flags);
- void MyDisposeGWorld (GWorldPtr offscreenGWorld);
- void MySetGWorld(GWorldPtr offscreenGWorld);
- void MyLockPixels(GWorldPtr offscreenGWorld);
- void MyUnlockPixels(GWorldPtr offscreenGWorld);
-
- /* ------------------------------------------------------------------------------------ */
- /* The following structure is used for setups */
- /* ------------------------------------------------------------------------------------ */
- #define kSetupDialogID 10000
- #define kSettingsID 10000
- #define kSettingsType 'FSET'
-
- typedef struct
- {
- ModalFilterProcPtr okCancelFilterProc;
-
- ProcPtr defaultUserItem;
- ProcPtr roundRectUser;
- ProcPtr aboutUserItem;
-
- ProcPtr setUserItem;
- ProcPtr getItemCtlValue;
- ProcPtr setItemCtlValue;
- ProcPtr getClusterValue;
- ProcPtr setClusterValue;
- ProcPtr setLabeledCtlValue;
- ProcPtr setItemString;
- ProcPtr getItemString;
- ProcPtr getItemRect;
- ProcPtr centerWindow;
- } SetupParamBlock;
-
- #define OKCancelFilterProc (*theSetup->okCancelFilterProc)
- // standard filter proc for command-. and return/enter key
-
- #define DefaultUserItem (*theSetup->defaultUserItem)
- // A user item for filling a useritem with a rounded rect for default buttons
- #define RoundRectUser (*theSetup->roundRectUser)
- // A user item for thin rounded rects
-
- #define AboutUserItem (*theSetup->aboutUserItem)
- // A user item for drawing STR 10000 in 9 point applFont
-
- #define SetUserItem (*theSetup->setUserItem)
- // For setting a given item's userItem proc : SetUserItem(dPtr, item, proc);
-
- #define GetItemCtlValue (*theSetup->getItemCtlValue)
- // Returns an item's control value : value = GetItemCtlValue(dPtr, item);
-
- #define SetItemCtlValue (*theSetup->setItemCtlValue)
- // Sets an item's control value : SetItemCtlValue(dPtr, item, value);
-
- #define GetClusterValue (*theSetup->getClusterValue)
- // Gets a value for a cluster of controls, 0 = first control value = GetClusterValue(dPtr, min, max);
-
- #define SetClusterValue (*theSetup->setClusterValue)
- // Sets the value for a cluster of controls, SetClusterValue(dPtr, min, max, value);
-
- #define SetLabeledCtlValue (*theSetup->setLabeledCtlValue)
- // the value of a control, and a tag string on another item: SetLabeleCtlValue(dPtr, item, labelStaticItem, value);
-
- #define SetItemString (*theSetup->setItemString)
- // Sets the string of an item, SetItemString(dPtr, item, string);
-
- #define GetItemString (*theSetup->getItemString)
- // Gets the string of an item, GetItemString(dPtr, item, string);
-
- #define GetItemRect (*theSetup->getItemRect)
- // gets the rectangle of, GetItemRect(dPtr, item, *theRect);
-
- #define CenterWindow (*theSetup->centerWindow)
- // centers a WIND or DLOG template, CenterWindow(ResType theType, short resID,
- // Point * wherePlaced) - wherePlaced may be nil
-
-
- /* ------------------------------------------------------------------------------------ */
- /* The following routines are in the Blackout. Change them to implement various displays.*/
- /* ------------------------------------------------------------------------------------ */
-
- BlackoutHandle PreflightBlackout(long * minSleepTime, long * maxSleepTime);
- Boolean InitBlackout(BlackoutHandle theBlackout, WindowPtr blackoutWindow);
- void BlackoutIdle(WindowPtr blackoutWindow, BlackoutHandle theBlackout);
- Boolean BlackoutEvent(EventRecord *theEvent);
- void DisposeBlackout(BlackoutHandle theBlackout);
-
- /* ------------------------------------------------------------------------------------ */
- /* Useful macros for your fader */
- /* ------------------------------------------------------------------------------------ */
- #define TopLeft(aRect) (* (Point *) &(aRect).top)
- #define BotRight(aRect) (* (Point *) &(aRect).bottom)
- #define RectWidth(r) (short)((r)->right - (r)->left)
- #define RectHeight(r) (short)((r)->bottom - (r)->top)
-
- /* ------------------------------------------------------------------------------------ */
- /* The following globals are useful information about the Mac */
- /* ------------------------------------------------------------------------------------ */
- #ifndef INMAINBLACKOUT
- extern SysEnvRec theEnvirons;
- #endif
-
- // Faders should be in the main segment by default
- #pragma segment Main
-